package classes.controller
{
	import flash.external.ExternalInterface;

	public class DAOSendFlash
	{
		static private var _sendInstance:DAOSendFlash;
		public function DAOSendFlash(singletonEnforcer:SingletonEnforcer){}
		
		public static function getLoadInstance():DAOSendFlash
		{
			if(DAOSendFlash._sendInstance == null){
				DAOSendFlash._sendInstance = new DAOSendFlash(new SingletonEnforcer());	
			}
			return DAOSendFlash._sendInstance;
		}
		public function setData($proxy:String, $obj:Object):void
		{
			//오브젝트만 묶어서 보내세요.
			//프록시는 스트링만 보내주시요.
			$obj.proxy = $proxy;
			
			if (ExternalInterface.available) {
				try {
					ExternalInterface.call("send2Server", $obj);
				} catch (error:SecurityError) {
					trace("A SecurityError occurred: " + error.message + "\n");
				} catch (error:Error) {
					trace("An Error occurred: " + error.message + "\n");
				}
			}
		}
	}
}


class SingletonEnforcer{}